struct {
	fwindow_t data;
	fwindow_t table;
	int       chunk_size;
	void *    buffer;
	int       pos;
} zfile_t;


int zfile_init(zfile_t * self, size_t chunk_size)
{
	self->buffer = malloc(chunk_size);
	self->chunk_size = chunk_size;
	self->pos = 0;
	return 0;
}

int zfile_fini(zfile_t * self)
{
	int res = 0;
	if (self->buffer != NULL) {
		free(self->buffer);
		self->buffer = NULL;
	}
	if (fwindow_fini(self->data) != 0) {
		res = -1;
	}
	if (fwindow_fini(self->index) != 0) {
		res = -1;
	}
	return res;
}

int zfile_write(zfile_t * self, void * buffer, size_t size)
{
	memcpy(self->buffer + self->pos, buffer, size);
	self->pos += self->pos;
	if (self->pos > self->chunk_size) {

	}
	while (size > 0) {
		if (self->pos )
		size -= written;
	}
}















